package com.dragon.repository.domain.vo;

import com.dragon.common.model.Update;
import com.dragon.common.util.BeanUtils;
import com.dragon.repository.entity.VendorBillSon;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotNull;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;


/**
 * @author sy
 */
@Data
@ApiModel(value = "")
public class VendorBillSonVO {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "自增id")
    private Integer id;

    @ApiModelProperty(value = "外发主表id")
    private Integer schedulingOutId;

    @ApiModelProperty(value = "供应商id")
    private Integer vendorId;

    @ApiModelProperty(value = "外发金额")
    private Double outMoney;

    @ApiModelProperty(value = "创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createTime;

    @ApiModelProperty(value = "供应商账单id")
    private Integer vendorBillId;

    @ApiModelProperty(value = "是否生成供应商账单 0否 1是")
    private Integer billStatus;


    @NotNull(groups = Update.class,message = "主键不能为空")
    public static VendorBillSon convert(VendorBillSonVO vo) {
        VendorBillSon entity = new VendorBillSon();
        BeanUtils.copyProperties(vo,entity);
        return entity;
    }
    public static List<VendorBillSon> convertList(List<VendorBillSonVO> list) {
        List<VendorBillSon> resultList = new ArrayList<>();
        for (VendorBillSonVO vo : list) {
            resultList.add(convert(vo));
        }
        return resultList;
    }
}
